<?php
error_reporting(E_ALL);
ob_start('ob_gzhandler');

define('APP_ROOT',    dirname(__FILE__));
define('FPS_ROOT',    dirname(__DIR__));
define('FPS_PROJECT', 'project');

$conf_file = false;
if (isset($_SERVER["FPS_CONFIG_ROOT"])) {
	$conf_file = $_SERVER["FPS_CONFIG_ROOT"] . '/config.php';
	if (!file_exists($conf_file)) {
		$conf_file = false;
	}
}
if (!$conf_file) {
	$conf_file = APP_ROOT . '/config.php';
}

require_once($conf_file);
require_once(FPS_ROOT . '/core.php');
require_once(FPS_ROOT . '/json.php');
require_once(FPS_ROOT . '/view.php');

function fps_on_login() {
    header('Location: ?uri=/login');
    exit;
}

if (fps_run() === false) {
	json_out(404, 'uri not found');
}